package com.maisha.Service.cms;

import java.sql.SQLException;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.maisha.Dao.cms.CMSLoginDaoImp;
import com.maisha.Service.IService.ICmsLoginService;
import com.maisha.bean.Auditor;
import com.maisha.utils.SuitConstant;

@Service(value="cmsLoginService")
public class CMSLoginServiceImp implements ICmsLoginService {
	
	private static final Logger log = Logger.getLogger(CMSLoginServiceImp.class);
	@Resource
	private CMSLoginDaoImp cmsLoginDaoImp;
	
	public Auditor getObjectAuditor(String name,String password){
		String sql = "select id,audit_name AS auditName from auditor where audit_name=? and password=? and is_valid=?";
		Auditor auditor = null;
		try {
			auditor = cmsLoginDaoImp.getResultObject(sql, Auditor.class, name,password,SuitConstant.isValid.VALID.getValue());
		} catch (SQLException e) {
			log.error("获得 管理员信息失败！");
			e.printStackTrace();
		}
		return auditor;
	}
	
	
}
